/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.service.dto;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import me.zhengjie.annotation.Query;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author xinglin
 * @website https://eladmin.vip
 * @date 2024-08-03
 **/
@Data
public class PPInfoQueryCriteria {

    /**
     * 查询条件：批次（模糊查询）
     */
    @Query(type = Query.Type.INNER_LIKE)
    private String batch;

    /**
     * 查询条件：板子批号模糊查询）
     */
    @Query(type = Query.Type.INNER_LIKE)
    private String pp;

    /**
     * 查询条件：pp批次（模糊查询）
     */
    @Query(type = Query.Type.INNER_LIKE)
    private String ppBatch;

    //是否打包  0-打包  1-没打包
    @Query(type = Query.Type.EQUAL)
    private Integer isPakage;

    @Query(type = Query.Type.INNER_LIKE)
    private String StorageCode;

    @Query(type = Query.Type.BETWEEN)
    private String inBoundTime;

    @Query(type = Query.Type.BETWEEN)
    private String outBoundTime;


    @Query(type = Query.Type.INNER_LIKE)
    private String palletCode;

    @Query(type = Query.Type.INNER_LIKE)
    private String ppMaterial;


    @Query(type = Query.Type.INNER_LIKE)
    private String ppModel;

    @Query(type = Query.Type.INNER_LIKE)
    private String ppMfrs;

    @Query(type = Query.Type.INNER_LIKE)
    private String ppSize;

    @Query(type = Query.Type.EQUAL)
    private Integer ppQty;

    @Query(type = Query.Type.BETWEEN)
    private String ppPd;


//    @Query(type = Query.Type.BETWEEN)
//    private String ppPdStart;
//
//    @Query(type = Query.Type.BETWEEN)
//    private String ppPdEnd;

    @Query(type = Query.Type.BETWEEN)
    private String ppExp;

//    @Query(type = Query.Type.BETWEEN)
//    private String ppExpStart;
//
//    @Query(type = Query.Type.BETWEEN)
//    private String ppExpEnd;

    @Query(type = Query.Type.INNER_LIKE)
    private String ppWorker;

    @Query(type = Query.Type.INNER_LIKE)
    private String ppDevice;

    @Query(type = Query.Type.INNER_LIKE)
    private String method;

    @Query(type = Query.Type.INNER_LIKE)
    private String rc;

    @Query(type = Query.Type.BETWEEN)
    private String ppPack;

//    @Query(type = Query.Type.BETWEEN)
//    private String ppPackStart;
//
//    @Query(type = Query.Type.BETWEEN)
//    private String ppPackEnd;

    @Query(type = Query.Type.INNER_LIKE)
    private String ppHole;


    @Query(type = Query.Type.EQUAL)
    private String dateStatus;

    @Query(type = Query.Type.EQUAL)
    private Integer stayStatus;

    @Query(type = Query.Type.EQUAL)
    private Integer lockStatus;

    // 添加转换方法


//    public LocalDateTime getPpPd() {
//        if (ppPd == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppPd, formatter);
//    }

//    public LocalDateTime getPpPdStart() {
//        if (ppPdStart == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppPdStart, formatter);
//    }
//
//    public LocalDateTime getPpPdEnd() {
//        if (ppPdEnd == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppPdEnd, formatter);
//    }

//    public LocalDateTime getPpExp() {
//        if (ppExp == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppExp, formatter);
//    }

//    public LocalDateTime getPpExpStart() {
//        if (ppExpStart == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppExpStart, formatter);
//    }
//
//    public LocalDateTime getPpExpEnd() {
//        if (ppExpEnd == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppExpEnd, formatter);
//    }


    public LocalDateTime getInBoundTime() {
        if (inBoundTime == null) return null;
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return LocalDateTime.parse(inBoundTime, formatter);
    }

    public LocalDateTime getOutBoundTime() {
        if (outBoundTime == null) return null;
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return LocalDateTime.parse(outBoundTime, formatter);
    }


//    public LocalDateTime getPpPack() {
//        if (ppPack == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppPack, formatter);
//    }

//    public LocalDateTime getPpPackStart() {
//        if (ppPackStart == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppPackStart, formatter);
//    }
//
//    public LocalDateTime getPpPackEnd() {
//        if (ppPackStart == null) return null;
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(ppPackStart, formatter);
//    }


}